<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="问题名称" prop="issueName">
        <el-input
          v-model="queryParams.issueName"
          placeholder="请输入问题名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="问题发现方式" prop="issueDiscovery">
        <el-input
          v-model="queryParams.issueDiscovery"
          placeholder="请输入问题发现方式"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="质量体系问题涉及过程" prop="involveProcess">
        <el-input
          v-model="queryParams.involveProcess"
          placeholder="请输入质量体系问题涉及过程"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="统一社会信用代码" prop="creditCodes">
        <el-input
          v-model="queryParams.creditCodes"
          placeholder="请输入统一社会信用代码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="承制单位性质" prop="contractorUnitNature">
        <el-input
          v-model="queryParams.contractorUnitNature"
          placeholder="请输入承制单位性质"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="监管方式" prop="supervisionMethod">
        <el-input
          v-model="queryParams.supervisionMethod"
          placeholder="请输入监管方式"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="发现问题JS代表" prop="foundProblems">
        <el-input
          v-model="queryParams.foundProblems"
          placeholder="请输入发现问题JS代表"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="计划归零时间" prop="plannedZeroTime">
        <el-date-picker clearable
          v-model="queryParams.plannedZeroTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择计划归零时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="监管JDB室" prop="representativeOffice">
        <el-input
          v-model="queryParams.representativeOffice"
          placeholder="请输入监管JDB室"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="处理牵头组织单位" prop="dealWithOrganization">
        <el-input
          v-model="queryParams.dealWithOrganization"
          placeholder="请输入处理牵头组织单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="问题事实描述" prop="problemFactDescription">
        <el-input
          v-model="queryParams.problemFactDescription"
          placeholder="请输入问题事实描述"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="问题原因详述" prop="causeDetails">
        <el-input
          v-model="queryParams.causeDetails"
          placeholder="请输入问题原因详述"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="解决措施落实情况" prop="settlementMeasures">
        <el-input
          v-model="queryParams.settlementMeasures"
          placeholder="请输入解决措施落实情况"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="问题编号" prop="questionNumber">
        <el-input
          v-model="queryParams.questionNumber"
          placeholder="请输入问题编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="问题直接原因类别" prop="directCauseCategory">
        <el-input
          v-model="queryParams.directCauseCategory"
          placeholder="请输入问题直接原因类别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="问题模式" prop="problemModel">
        <el-input
          v-model="queryParams.problemModel"
          placeholder="请输入问题模式"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="承制单位代号" prop="contractorUnitCode">
        <el-input
          v-model="queryParams.contractorUnitCode"
          placeholder="请输入承制单位代号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="承制单位所属部门" prop="contractorDepartment">
        <el-input
          v-model="queryParams.contractorDepartment"
          placeholder="请输入承制单位所属部门"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="JDBJJ印章序号" prop="representativeOfficeSealNumber">
        <el-input
          v-model="queryParams.representativeOfficeSealNumber"
          placeholder="请输入JDBJJ印章序号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="发现问题日期" prop="discoveryDate">
        <el-input
          v-model="queryParams.discoveryDate"
          placeholder="请输入发现问题日期"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="监管JDB局" prop="representativeBureau">
        <el-input
          v-model="queryParams.representativeBureau"
          placeholder="请输入监管JDB局"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="问题处理JS代表" prop="problemSolving">
        <el-input
          v-model="queryParams.problemSolving"
          placeholder="请输入问题处理JS代表"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="问题归零情况" prop="problemZero">
        <el-input
          v-model="queryParams.problemZero"
          placeholder="请输入问题归零情况"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="质量问题级别" prop="problemLevel">
        <el-input
          v-model="queryParams.problemLevel"
          placeholder="请输入质量问题级别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="内外场区别" prop="differenceFields">
        <el-input
          v-model="queryParams.differenceFields"
          placeholder="请输入内外场区别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否拉条挂账" prop="hangAccount">
        <el-input
          v-model="queryParams.hangAccount"
          placeholder="请输入是否拉条挂账"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否归零" prop="returnZero">
        <el-input
          v-model="queryParams.returnZero"
          placeholder="请输入是否归零"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="责任人" prop="personLiable">
        <el-input
          v-model="queryParams.personLiable"
          placeholder="请输入责任人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="责任单位" prop="responsibleUnit">
        <el-input
          v-model="queryParams.responsibleUnit"
          placeholder="请输入责任单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="用户ID" prop="userId">
        <el-input
          v-model="queryParams.userId"
          placeholder="请输入用户ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门ID" prop="deptId">
        <el-input
          v-model="queryParams.deptId"
          placeholder="请输入部门ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建者" prop="createBy">
        <el-input
          v-model="queryParams.createBy"
          placeholder="请输入创建者"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-date-picker clearable
          v-model="queryParams.createTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="更新者" prop="updateBy">
        <el-input
          v-model="queryParams.updateBy"
          placeholder="请输入更新者"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="更新时间" prop="updateTime">
        <el-date-picker clearable
          v-model="queryParams.updateTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择更新时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:dailyquality:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:dailyquality:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:dailyquality:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:dailyquality:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="dailyqualityList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column label="问题名称" align="center" prop="issueName" />
      <el-table-column label="问题属性" align="center" prop="issueType" />
      <el-table-column label="问题发现方式" align="center" prop="issueDiscovery" />
      <el-table-column label="质量体系问题涉及过程" align="center" prop="involveProcess" />
      <el-table-column label="统一社会信用代码" align="center" prop="creditCodes" />
      <el-table-column label="承制单位性质" align="center" prop="contractorUnitNature" />
      <el-table-column label="监管方式" align="center" prop="supervisionMethod" />
      <el-table-column label="发现问题JS代表" align="center" prop="foundProblems" />
      <el-table-column label="计划归零时间" align="center" prop="plannedZeroTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.plannedZeroTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="监管JDB室" align="center" prop="representativeOffice" />
      <el-table-column label="处理牵头组织单位" align="center" prop="dealWithOrganization" />
      <el-table-column label="问题事实描述" align="center" prop="problemFactDescription" />
      <el-table-column label="问题原因详述" align="center" prop="causeDetails" />
      <el-table-column label="解决措施落实情况" align="center" prop="settlementMeasures" />
      <el-table-column label="问题编号" align="center" prop="questionNumber" />
      <el-table-column label="问题直接原因类别" align="center" prop="directCauseCategory" />
      <el-table-column label="问题模式" align="center" prop="problemModel" />
      <el-table-column label="承制单位代号" align="center" prop="contractorUnitCode" />
      <el-table-column label="承制单位所属部门" align="center" prop="contractorDepartment" />
      <el-table-column label="JDBJJ印章序号" align="center" prop="representativeOfficeSealNumber" />
      <el-table-column label="发现问题日期" align="center" prop="discoveryDate" />
      <el-table-column label="监管JDB局" align="center" prop="representativeBureau" />
      <el-table-column label="问题处理JS代表" align="center" prop="problemSolving" />
      <el-table-column label="问题归零情况" align="center" prop="problemZero" />
      <el-table-column label="质量问题级别" align="center" prop="problemLevel" />
      <el-table-column label="内外场区别" align="center" prop="differenceFields" />
      <el-table-column label="是否拉条挂账" align="center" prop="hangAccount" />
      <el-table-column label="是否归零" align="center" prop="returnZero" />
      <el-table-column label="责任人" align="center" prop="personLiable" />
      <el-table-column label="责任单位" align="center" prop="responsibleUnit" />
      <el-table-column label="附件" align="center" prop="accessories" />
      <el-table-column label="用户ID" align="center" prop="userId" />
      <el-table-column label="部门ID" align="center" prop="deptId" />
      <el-table-column label="创建者" align="center" prop="createBy" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新者" align="center" prop="updateBy" />
      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="备注1" align="center" prop="note1" />
      <el-table-column label="备注2" align="center" prop="note2" />
      <el-table-column label="备注3" align="center" prop="note3" />
      <el-table-column label="备注4" align="center" prop="note4" />
      <el-table-column label="备注5" align="center" prop="note5" />
      <el-table-column label="备注6" align="center" prop="note6" />
      <el-table-column label="备注7" align="center" prop="note7" />
      <el-table-column label="备注8" align="center" prop="note8" />
      <el-table-column label="备注9" align="center" prop="note9" />
      <el-table-column label="备注10" align="center" prop="note10" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:dailyquality:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:dailyquality:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改日常质量问题报对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="问题名称" prop="issueName">
          <el-input v-model="form.issueName" placeholder="请输入问题名称" />
        </el-form-item>
        <el-form-item label="问题发现方式" prop="issueDiscovery">
          <el-input v-model="form.issueDiscovery" placeholder="请输入问题发现方式" />
        </el-form-item>
        <el-form-item label="质量体系问题涉及过程" prop="involveProcess">
          <el-input v-model="form.involveProcess" placeholder="请输入质量体系问题涉及过程" />
        </el-form-item>
        <el-form-item label="统一社会信用代码" prop="creditCodes">
          <el-input v-model="form.creditCodes" placeholder="请输入统一社会信用代码" />
        </el-form-item>
        <el-form-item label="承制单位性质" prop="contractorUnitNature">
          <el-input v-model="form.contractorUnitNature" placeholder="请输入承制单位性质" />
        </el-form-item>
        <el-form-item label="监管方式" prop="supervisionMethod">
          <el-input v-model="form.supervisionMethod" placeholder="请输入监管方式" />
        </el-form-item>
        <el-form-item label="发现问题JS代表" prop="foundProblems">
          <el-input v-model="form.foundProblems" placeholder="请输入发现问题JS代表" />
        </el-form-item>
        <el-form-item label="计划归零时间" prop="plannedZeroTime">
          <el-date-picker clearable
            v-model="form.plannedZeroTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择计划归零时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="监管JDB室" prop="representativeOffice">
          <el-input v-model="form.representativeOffice" placeholder="请输入监管JDB室" />
        </el-form-item>
        <el-form-item label="处理牵头组织单位" prop="dealWithOrganization">
          <el-input v-model="form.dealWithOrganization" placeholder="请输入处理牵头组织单位" />
        </el-form-item>
        <el-form-item label="问题事实描述" prop="problemFactDescription">
          <el-input v-model="form.problemFactDescription" placeholder="请输入问题事实描述" />
        </el-form-item>
        <el-form-item label="问题原因详述" prop="causeDetails">
          <el-input v-model="form.causeDetails" placeholder="请输入问题原因详述" />
        </el-form-item>
        <el-form-item label="解决措施落实情况" prop="settlementMeasures">
          <el-input v-model="form.settlementMeasures" placeholder="请输入解决措施落实情况" />
        </el-form-item>
        <el-form-item label="问题编号" prop="questionNumber">
          <el-input v-model="form.questionNumber" placeholder="请输入问题编号" />
        </el-form-item>
        <el-form-item label="问题直接原因类别" prop="directCauseCategory">
          <el-input v-model="form.directCauseCategory" placeholder="请输入问题直接原因类别" />
        </el-form-item>
        <el-form-item label="问题模式" prop="problemModel">
          <el-input v-model="form.problemModel" placeholder="请输入问题模式" />
        </el-form-item>
        <el-form-item label="承制单位代号" prop="contractorUnitCode">
          <el-input v-model="form.contractorUnitCode" placeholder="请输入承制单位代号" />
        </el-form-item>
        <el-form-item label="承制单位所属部门" prop="contractorDepartment">
          <el-input v-model="form.contractorDepartment" placeholder="请输入承制单位所属部门" />
        </el-form-item>
        <el-form-item label="JDBJJ印章序号" prop="representativeOfficeSealNumber">
          <el-input v-model="form.representativeOfficeSealNumber" placeholder="请输入JDBJJ印章序号" />
        </el-form-item>
        <el-form-item label="发现问题日期" prop="discoveryDate">
          <el-input v-model="form.discoveryDate" placeholder="请输入发现问题日期" />
        </el-form-item>
        <el-form-item label="监管JDB局" prop="representativeBureau">
          <el-input v-model="form.representativeBureau" placeholder="请输入监管JDB局" />
        </el-form-item>
        <el-form-item label="问题处理JS代表" prop="problemSolving">
          <el-input v-model="form.problemSolving" placeholder="请输入问题处理JS代表" />
        </el-form-item>
        <el-form-item label="问题归零情况" prop="problemZero">
          <el-input v-model="form.problemZero" placeholder="请输入问题归零情况" />
        </el-form-item>
        <el-form-item label="质量问题级别" prop="problemLevel">
          <el-input v-model="form.problemLevel" placeholder="请输入质量问题级别" />
        </el-form-item>
        <el-form-item label="内外场区别" prop="differenceFields">
          <el-input v-model="form.differenceFields" placeholder="请输入内外场区别" />
        </el-form-item>
        <el-form-item label="是否拉条挂账" prop="hangAccount">
          <el-input v-model="form.hangAccount" placeholder="请输入是否拉条挂账" />
        </el-form-item>
        <el-form-item label="是否归零" prop="returnZero">
          <el-input v-model="form.returnZero" placeholder="请输入是否归零" />
        </el-form-item>
        <el-form-item label="责任人" prop="personLiable">
          <el-input v-model="form.personLiable" placeholder="请输入责任人" />
        </el-form-item>
        <el-form-item label="责任单位" prop="responsibleUnit">
          <el-input v-model="form.responsibleUnit" placeholder="请输入责任单位" />
        </el-form-item>
        <el-form-item label="附件" prop="accessories">
          <el-input v-model="form.accessories" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="用户ID" prop="userId">
          <el-input v-model="form.userId" placeholder="请输入用户ID" />
        </el-form-item>
        <el-form-item label="部门ID" prop="deptId">
          <el-input v-model="form.deptId" placeholder="请输入部门ID" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注1" prop="note1">
          <el-input v-model="form.note1" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注2" prop="note2">
          <el-input v-model="form.note2" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注3" prop="note3">
          <el-input v-model="form.note3" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注4" prop="note4">
          <el-input v-model="form.note4" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注5" prop="note5">
          <el-input v-model="form.note5" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注6" prop="note6">
          <el-input v-model="form.note6" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注7" prop="note7">
          <el-input v-model="form.note7" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注8" prop="note8">
          <el-input v-model="form.note8" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注9" prop="note9">
          <el-input v-model="form.note9" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注10" prop="note10">
          <el-input v-model="form.note10" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listDailyquality, getDailyquality, delDailyquality, addDailyquality, updateDailyquality } from "@/api/system/dailyquality";

export default {
  name: "Dailyquality",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 日常质量问题报表格数据
      dailyqualityList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        issueName: null,
        issueType: null,
        issueDiscovery: null,
        involveProcess: null,
        creditCodes: null,
        contractorUnitNature: null,
        supervisionMethod: null,
        foundProblems: null,
        plannedZeroTime: null,
        representativeOffice: null,
        dealWithOrganization: null,
        problemFactDescription: null,
        causeDetails: null,
        settlementMeasures: null,
        questionNumber: null,
        directCauseCategory: null,
        problemModel: null,
        contractorUnitCode: null,
        contractorDepartment: null,
        representativeOfficeSealNumber: null,
        discoveryDate: null,
        representativeBureau: null,
        problemSolving: null,
        problemZero: null,
        problemLevel: null,
        differenceFields: null,
        hangAccount: null,
        returnZero: null,
        personLiable: null,
        responsibleUnit: null,
        accessories: null,
        userId: null,
        deptId: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询日常质量问题报列表 */
    getList() {
      this.loading = true;
      listDailyquality(this.queryParams).then(response => {
        this.dailyqualityList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        issueName: null,
        issueType: null,
        issueDiscovery: null,
        involveProcess: null,
        creditCodes: null,
        contractorUnitNature: null,
        supervisionMethod: null,
        foundProblems: null,
        plannedZeroTime: null,
        representativeOffice: null,
        dealWithOrganization: null,
        problemFactDescription: null,
        causeDetails: null,
        settlementMeasures: null,
        questionNumber: null,
        directCauseCategory: null,
        problemModel: null,
        contractorUnitCode: null,
        contractorDepartment: null,
        representativeOfficeSealNumber: null,
        discoveryDate: null,
        representativeBureau: null,
        problemSolving: null,
        problemZero: null,
        problemLevel: null,
        differenceFields: null,
        hangAccount: null,
        returnZero: null,
        personLiable: null,
        responsibleUnit: null,
        accessories: null,
        userId: null,
        deptId: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加日常质量问题报";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getDailyquality(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改日常质量问题报";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateDailyquality(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addDailyquality(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除日常质量问题报编号为"' + ids + '"的数据项？').then(function() {
        return delDailyquality(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/dailyquality/export', {
        ...this.queryParams
      }, `dailyquality_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
